<!-- 意见反馈 页面 -->
<template>
	<view class="feedback-container-box">
		<!-- 没有反馈记录时显示 -->
		<data-null tipText="暂无反馈记录" v-if="!feedbackDataList.length"></data-null>

		<!-- 有记录时显示记录 -->
		<block v-else>
			<view class="feedback-item-box" v-for="fbItem in feedbackDataList" :key="fbItem.id">
				<view class="aratar-box"><u-avatar size="60" mode="square" :src="fbItem.avatar"></u-avatar></view>
				<view class="name">{{ fbItem.nick_name }}</view>
				<view class="">{{ fbItem.comment }}</view>
				<view class="time">{{ fbItem.create_time }}</view>
			</view>
		</block>

		<bottom-btn text="添加反馈" @click="addFeedbackClick"></bottom-btn>
	</view>
</template>

<script>
export default {
	data() {
		return {
			// 反馈记录数据列表
			feedbackDataList: []
		};
	},
	onLoad() {
		this.getDataList()
	},
	onShow() {
		if(this.vuex_isSubmit) {
			this.feedbackDataList = []
			this.getDataList()
			this.$u.vuex('vuex_isSubmit', false)
		}
	},
	methods: {
		async getDataList() {
			const res = await this.$u.api.getFeedBackList({page: 1, page_size: 999})
			if(!res) return
			this.feedbackDataList = res
			// console.log(this.feedbackDataList);
		},
		// 添加反馈按钮的点击事件
		addFeedbackClick() {
			// console.log(1);
			this.$u.route('/myPackageA/pages/views/add-feedback');
		}
	}
};
</script>

<style lang="scss" scoped>
.feedback-container-box {
	width: 750rpx;
	min-height: 100vh;
	padding-bottom: 90rpx;
}
.feedback-item-box {
	width: 750rpx;
	min-height: 185rpx;
	border-bottom: 1px solid #e8e8e8;
	padding: 36rpx 24rpx 36rpx 108rpx;
	font-size: 28rpx;
	font-family: Adobe Heiti Std;
	font-weight: normal;
	color: #666666;
	position: relative;
	.aratar-box {
		width: 60rpx;
		height: 60rpx;
		background: #d1d1d1;
		border-radius: 6rpx;
		overflow: hidden;
		position: absolute;
		top: 33rpx;
		left: 24rpx;
	}
	.name {
		font-size: 32rpx;
		color: #141418;
	}
	.time {
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #666666;
	}
}
</style>
